#!/bin/bash
sum=0

if [ $# -lt 2 ]
then
	echo "请指定两个数值参数"
elif [ $1 -eq $2 ]
then
	sum=$1
elif [ $1 -lt $2 ]
then 
	for((i=$1;i<=$2;i++))
	do
	sum=$[$sum+$i]
	done
	echo "总和为$sum"
else
	for((i=$2;i<=$1;i++))
	do
	sum=$[$sum+$i]
	done
	echo "总和为$sum"
fi
